FROM registry.cn-hangzhou.aliyuncs.com/xiaoyilin/java17:0.17-d132slim
ARG P_V
ADD apache-pulsar-${P_V}-bin.tar.gz /usr/local/
ENV PULSAR_V=/usr/local/apache-pulsar-${P_V}
ENV PATH=$PULSAR_V/bin:$PATH
WORKDIR /usr/local
# Start a Pulsar standalone cluster
CMD ["pulsar","standalone"]
# Pulsar集群启动时会创建以下目录：data和logs
# Pulsar将消息存储在主题中。
# 使用主题前明确创建主题是一种很好的做法，即使Pulsar可以在引用主题时自动创建主题。
# pulsar-admin topics create persistent://public/default/my-topic
# Write messages
# pulsar-client produce my-topic --messages 'Hello Pulsar'
# Read messages
# Earliest从最早未被使用的消息开始消费
# -n 消费的消息数量，0表示永远消费。
# pulsar-client consume my-topic -s 'my-subscription' -p Earliest -n 0

# docker build --build-arg P_V=3.0.15 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/pulsar:3.0.15 .
# docker build --build-arg P_V=4.0.8 -t registry.cn-hangzhou.aliyuncs.com/xiaoyilin/pulsar:4.0.8 .
# docker run --rm registry.cn-hangzhou.aliyuncs.com/xiaoyilin/pulsar:3.0.15
# docker run -p 6650:6650 -d registry.cn-hangzhou.aliyuncs.com/xiaoyilin/pulsar:3.0.15
# docker push registry.cn-hangzhou.aliyuncs.com/xiaoyilin/pulsar:3.0.15